package org.shiki.hrm.mapper;

import com.baomidou.mybatisplus.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.shiki.hrm.domain.LoginUser;
import org.shiki.hrm.domain.Permission;
import java.util.List;

/**
 * <p>
 * Mapper 接口
 * </p>
 *
 * @author shiki
 * @since 2022-03-09
 */
public interface LoginUserMapper extends BaseMapper<LoginUser> {

	@Select("select t3.* from t_user_role t1\n" +
						"left join t_role_permission t2 on t1.role_id = t2.role_id\n" +
						"left join t_permission t3 on t2.permission_id = t3.id where t1.user_id =#{id}")
	List<Permission> selectPermissionById(Long id);
}
